﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using Newtonsoft.Json;
using ThangNM_LIB.FUNC;

namespace EntityObject
{
    [Serializable()]
    public class PHDEO
    {
        public Int32 PK_iVID { get; set; }
        public String sTitle { get; set; }
        public String sDescription { get; set; }
        public String sKeyword { get; set; }
        public String sInfoEx { get; set; }
        public String sUrl { get; set; }
        public String sImagePoster { get; set; }
        public String sImageSmall { get; set; }
        public String sImageMedium { get; set; }
        public String sImageLarge { get; set; }
        public String sVideo240p { get; set; }
        public String sVideo480p { get; set; }
        public String sVideo720p { get; set; }
        public String sVideo1080p { get; set; }
        public Int32 iVideoServerId { get; set; }
        public Int32 iVisit { get; set; }
        public Int16 iSync { get; set; }
        public Boolean bStatus { get; set; }
        public DateTime? tDateCreate { get; set; }

        //public PHDEO(players _players, String _sTitle, String _sDescription, String _sKeyword, String _sInfoEx, String _sUrl)
        public PHDEO(players _players)
        {
            //this.sTitle =ConvertEx.SQLite.RemoveSpecialCharacter( _sTitle);
            //this.sDescription = ConvertEx.SQLite.RemoveSpecialCharacter(_sDescription);
            //this.sKeyword =ConvertEx.SQLite.RemoveSpecialCharacter( _sKeyword);
            //this.sInfoEx = ConvertEx.SQLite.RemoveSpecialCharacter(_sInfoEx);
            //this.sUrl = ConvertEx.SQLite.RemoveSpecialCharacter(_sUrl);
            if (_players != null)
            {
                this.PK_iVID = _players.videoId;
                this.iVideoServerId = _players.videoServerId;
                this.sImagePoster = ConvertEx.SQLite.RemoveSpecialCharacter(_players.poster);
                this.sImageSmall = "";
                this.sImageMedium = "";
                this.sImageLarge = "";
                if (_players.sources != null)
                {
                    this.sVideo240p = _players.sources.p240;
                    this.sVideo480p = _players.sources.p480;
                    this.sVideo720p = _players.sources.p720;
                    this.sVideo1080p = _players.sources.p1080;
                }
                //this.sInfoEx = ConvertEx.SQLite.RemoveSpecialCharacter(JsonEx.Object2Json(_players));
            }
        }

        public PHDEO()
        {
        }
    }
    [Serializable()]
    public class PHD_EXEO
    {
        public Int32 PK_iVID { get; set; }
        public String sTitle { get; set; }
        public String sUrl { get; set; }
        public String sImageSmall { get; set; }
    }

    public class players
    {
        public String flashPlayer { get; set; }
        public String playerId { get; set; }
        public String poster { get; set; }
        public String providerCdn { get; set; }
        public String isEmbed { get; set; }
        public Int32 videoServerId { get; set; }
        public Int32 videoId { get; set; }
        public Int32 streamTtl { get; set; }
        public String getStreamApiUrl { get; set; }
        public List<previewSprites> previewSprites { get; set; }
        public sources sources { get; set; }
    }

    public class previewSprites
    {
    }

    public class sources
    {
        [JsonProperty(PropertyName = "240p")]
        public String p240 { get; set; }

        [JsonProperty(PropertyName = "480p")]
        public String p480 { get; set; }

        [JsonProperty(PropertyName = "720p")]
        public String p720 { get; set; }

        [JsonProperty(PropertyName = "1080p")]
        public String p1080 { get; set; }
    }
}